//
//  DoctorApplyController.m
//  SWS_Project00
//
//  Created by 马继鵬 on 17/3/10.
//  Copyright © 2017年 SWS. All rights reserved.
//

#import "DoctorApplyController.h"
#import "NETWorkTool.h"
#import "SJPApplyCell.h"
#import "SJPApplyModel.h"
#import "SJPApplyViewController.h"
@interface DoctorApplyController ()
@property (strong,nonatomic) NSArray* applyInfoList;

//@property (nonatomic,weak)UITableView *tableView;
@end
static NSString* cell_ID = @"cell_ID";
@implementation DoctorApplyController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    self.navigationController.navigationBar.translucent = NO;
    
//    UITableView * tableView = [[UITableView alloc] init];
//    [self.view addSubview:tableView];
//    self.tableView = tableView;
//    self.tableView.delegate = self;
//    self.tableView.dataSource = self;
//    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.edges.offset(0);
//    }];
    
    self.title = @"申请名医通";
//    [self.navigationController.navigationBar setTintColor:kThemeColor];
    [self.tableView registerClass:[SJPApplyCell class] forCellReuseIdentifier:cell_ID];
    [self loadData];
    self.tableView.rowHeight = 100;
}
#pragma
#pragma-加载数据
- (void)loadData
{
    NSString* path = [[NSBundle mainBundle]pathForResource:@"applyList.plist" ofType:nil];
    NSArray* arr = [NSArray arrayWithContentsOfFile:path];
    NSMutableArray* arrM = [NSMutableArray array];
    for (NSDictionary* dict in arr)
    {
        SJPApplyModel* model = [SJPApplyModel new];
        [model setValuesForKeysWithDictionary:dict];
        [arrM addObject:model];
    }
    _applyInfoList = arrM.copy;
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return _applyInfoList.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    SJPApplyCell *cell = [tableView dequeueReusableCellWithIdentifier:cell_ID forIndexPath:indexPath];
    cell.model = _applyInfoList[indexPath.row];
    
    return cell;
}


#pragma
#pragma-代理方法
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    SJPApplyViewController* controller = [SJPApplyViewController new];
    controller.model = _applyInfoList[indexPath.row];
    [self.navigationController pushViewController:controller animated:YES];
}

@end
